y_or_n = input('是否退出程序（y/n）：')
while y_or_n != 'y':
    try:
        gender = input("输入性别: ")
        weight = eval(input("输入体重(kg): "))
        height = eval(input("输入身高(cm): "))
        age = eval(input("输入年龄: "))
        if gender == '男':
            BMR = (13.7 * weight) + (5.0 * height) - (6.8 * age) + 66
        elif gender == '女':
            BMR = (9.6 * weight) + (1.8 * height) - (4.7 * age) + 655
        elif gender != ('男' or '女'):
            print('暂不支持该性别')
        if BMR != -1:
            print('您的性别：{},体重：{}公斤,身高：{}厘米,年龄：{}岁'.format(gender, weight, height, age))
        print('基础代谢率：{}大卡'.format(BMR))
    except:
        print('程序异常！')
    print()
    y_or_n = input('是否退出程序（y/n）：')
print('程序已退出！')
